var mongomq = require('mongomq');

console.log('creating mongo mq...');
var queue = new mongomq.MongoMQ({
	server: '172.20.240.227',
	autoStart: false
});

// set server forcely
queue.mongoConnection.server.host = '172.20.240.227';
console.log('mongoConnection: ' + JSON.stringify(queue.mongoConnection));

queue.start(function() {
	console.log('Queue listening started.');
	console.log('active: ' + queue.mongoConnection.active);
	
	queue.emit('smtp', {
		receiver: 'younghwan@lguplus.co.kr',
		sender: 'sejoonlim@lguplus.co.kr',
		message: '전자결재 1건이 상신되었습니다.'
	});
});